package com.xyh.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.apache.ibatis.annotations.Select;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Author:kyle
 * @Date:2020/12/23 - 14:01
 * @Project:spring_StudentsDormitoryManagementSystem
 * @Package:com.xyh.po
 * @Version:1.0
 */
@Getter
@Setter
@NoArgsConstructor
@Component
@TableName("t_user")
public class User implements Serializable {

    @TableId(value = "user_pkid",type = IdType.AUTO)
    private Integer id;
    private String username;
    private  String password;
    private String tel;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @TableField(value = "reg_time")
    private Date regTime;

    //权限
    @TableField(exist = false)
    private List<Permission> permissions;

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", tel='" + tel + '\'' +
                ", regTime=" + regTime +
                ", permissions=" + permissions +
                '}';
    }

}
